<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <form action="666" id="myForm"></form>
    <div id="myElement" style="color: antiquewhite">24567</div>
    <button id="myButton">按你一下</button>
    <script>
      // 第六题
      document.getElementById("myForm").action = "new_action.php";
      // 第七题
      document.getElementById("myElement").style.color = "red";
      // 第八题
      var data = document.getElementById("myElement");
      data.setAttribute("data-active", "true");

      // 检查是否存在 data-active 属性
      var have = data.getAttribute("data-active");

      if (have) {
        console.log("有");
      } else {
        console.log("没");
      }
    </script>
  </body>
</html>
